<?php

class friends_controller_contactlist extends Controller {
	/**
	 * 
	 *
	 * @var friends_model_data
	 */
	var $o;
	public function __construct($app, $controller){
		parent::__construct($app, $controller);
		$this->o = new friends_model_data();
		$this->headerView = $this->viewDir."/_header.phtml";
	}
	
	public function get_friends_action(){
		$this->requireLogin();
		$this->_renderJson();
		$uid = self::$login['uid'];
		$page = _('page', 1);
		$pageSize = 18;
		$this->ret = self::success(CacheManager::getInstance()->get(
			array(
				'app'=>$this->app,
				'controller'=>$this->controller,
				'func'=>array(
					array($this->o, "getFriendList"),
					array($uid, 500)
				)
			)
		));
	}
	
	public function get_category_action(){
		$this->requireLogin();
		$this->_renderJson();
		$uid = self::$login['uid'];
		$guilds = friends_util_contactlist::getGuilds($uid);
		$this->ret = self::success($guilds);
	}
	
	public function get_guild_members_action(){
		$this->requireLogin();
		$this->_renderJson();
		$domain = _('domain');
		$members = friends_util_contactlist::getGuildMembers($domain);
		$this->ret = self::success($members);
	}
}